<template>
  <div class="page gray-page act-page">
    <nav-bar title="我的活动"></nav-bar>
    <div class="list-main page-main">
      <van-sticky :offset-top="44">
        <van-tabs v-model="searchForm.status" color="#C92420" title-active-color="#C92420" @change="tabChange">
          <van-tab title="全部" name=""></van-tab>
          <van-tab v-for="(item, key) in tabList" :key="key" :title="item.description" :name="item.code"></van-tab>
        </van-tabs>
      </van-sticky>
      <div class="act-main">
        <act-list ref="actList" :searchForm="searchForm"></act-list>
      </div>
    </div>
  </div>
</template>
<script>
import Public from '@/api/public'
import ActList from '@/components/Widget/PartyBuilding/My/Act/list'
export default {
  components: { ActList },
  data() {
    return {
      tabList: [],
      searchForm: {
        status: '',
        pageNumber: 1,
        recordSize: 0,
        pageSize: 10
      }
    }
  },
  created() {
    this.init()
  },
  methods: {
    // 活动类型字典项
    init() {
      Public.Init.init({
        type: 'partyActivityStatus'
      }).then(res => {
        this.tabList = res.data.data.partyActivityStatus.filter(o => o.code === '2' || o.code === '3' || o.code === '4')
      })
    },
    tabChange(code) {
      this.searchForm.status = code
    }
  }
}
</script>

<style lang="less" scoped>
.act-main {
  margin-top: 104px;
}
</style>
